home *** CD-ROM | disk | FTP | other *** search
- /* TNConnect.c -- XCMD to open the TN3270 driver
- copyright 1989 Cornell University
-
- TNConnect hostid: Connect to a host.
-
- */
-
-
- #include <Types.h>
- #include <Memory.h>
- #include <Devices.h>
- #include <HyperXCmd.h>
- #include <Errors.h>
-
- #include <String.h>
-
- #include "TNdrvr.h"
-
-
- pascal void debugger() extern 0xA9FF;
-
-
- pascal void TNSendStr(hycp)
- XCmdPtr hycp;
- {
- CntrlParam drvpb;
- long * args;
- Str255 pstr;
-
- if (hycp->paramCount != 2) {
- sethand(&hycp->returnValue, "TNSendStr TNID,string: need 2 arguments");
- return;
- }
-
- HLock((Handle) hycp->params[0]);
- HLock((Handle) hycp->params[1]);
-
- ZeroToPas(hycp, *hycp->params[0], (StringPtr) &pstr[0]);
- drvpb.ioCRefNum = (short) StrToNum(hycp, (Str31 *) &pstr[0]);
- drvpb.csCode = HTN_SENDSTR;
- args = (long *) &drvpb.csParam[0];
- *args = * (long *) hycp->params[1];
- /* pass the string * to the drvr to pass on to TN3270 */
- PBControl((ParmBlkPtr) &drvpb, (Boolean) 0);
-
- if (drvpb.ioResult) {
- /* connect call failed */
- switch (drvpb.ioResult) {
- case HTNR_NOTN: {
- sethand(&hycp->returnValue, "TN is not running");
- break;
- }
- case HTNR_ACTIVE: {
- sethand(&hycp->returnValue, "TN not opened");
- break;
- }
- case HTNR_OPEN: {
- sethand(&hycp->returnValue, "TN has no connection");
- break;
- }
- case badUnitErr: {
- sethand(&hycp->returnValue, "TNID is incorrect");
- break;
- }
- default: {
- sethand(&hycp->returnValue, "Unknown error");
- break;
- }
- }
- }
- HUnlock((Handle) hycp->params[0]);
- HUnlock((Handle) hycp->params[1]);
-
- }
-
-
- sethand(thand, str)
- Handle * thand;
- char * str;
- {
- if (*thand == NULL) {
- *thand = NewHandle((Size) 0);
- }
- SetHandleSize(*thand, (long) (strlen(str) + 1));
- strcpy(**thand, str);
- }
-
-
-
-
- #include <XCmdGlue.inc.c>